export default {
    data () {
        return {
            page: 1,
            pageSize: 10,
            total: 0,
            pageOpts: [10, 15, 20, 30, 50],
            dimension: [
                {
                    name: '日',
                    id: '1'
                },
                {
                    name: '月',
                    id: '2'
                },
                {
                    name: '年',
                    id: '3'
                }
            ],
            grid: {
                xl: 4,
                lg: 8,
                md: 12,
                sm: 24,
                xs: 24
            }
        }
    },
    methods: {
        changePage (page) {
            this.page = page
            this.onRender()
        },
        changePageSize (pagesize) {
            this.pageSize = pagesize
            this.onRender()
        },
        onRender () {
            this.onLoad()
        },
        // 获取昨日的时间
        yesterday () {
            return new Date((new Date()).getTime() - 24 * 60 * 60 * 1000)
        },
        // 获取每个月月初时间
        nowDateOn (status) {
            const now = new Date()
            const nowMonth = now.getMonth()
            const nowYear = now.getFullYear()
            if (status === 1) {
                return new Date(nowYear, nowMonth, 1)
            } else if (status === 2) {
                return new Date(nowYear, nowMonth + 1, 0)
            }
        }
    }
}
